@use './variables.scss' as *;

// CSS重置样式
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: $font-family-base;
  font-size: $font-size-base;
  font-weight: $font-weight-normal;
  line-height: $line-height-normal;
  color: var(--text-color-primary);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  margin-bottom: $spacing-2;
  font-weight: $font-weight-semibold;
  line-height: $line-height-tight;
}

h1 { font-size: $font-size-3xl; }
h2 { font-size: $font-size-2xl; }
h3 { font-size: $font-size-xl; }
h4 { font-size: $font-size-lg; }
h5 { font-size: $font-size-base; }
h6 { font-size: $font-size-sm; }

p {
  margin-top: 0;
  margin-bottom: $spacing-4;
}

abbr[title] {
  border-bottom: none;
  text-decoration: underline;
  text-decoration: underline dotted;
}

b,
strong {
  font-weight: $font-weight-bold;
}

small {
  font-size: 80%;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  background-color: transparent;
  
  &:hover {
    color: var(--primary-color);
    text-decoration: underline;
  }
  
  &:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
}

pre,
code,
kbd,
samp {
  font-family: $font-family-mono;
  font-size: 1em;
}

pre {
  margin-top: 0;
  margin-bottom: $spacing-4;
  padding: $spacing-4;
  overflow-x: auto;
  background-color: var(--bg-color-secondary);
  border-radius: $border-radius-md;
}

img {
  border-style: none;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

button,
input,
optgroup,
select,
textarea {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button,
input {
  overflow: visible;
}

button,
select {
  text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

fieldset {
  padding: 0.35em 0.75em 0.625em;
}

legend {
  box-sizing: border-box;
  color: inherit;
  display: table;
  max-width: 100%;
  padding: 0;
  white-space: normal;
}

progress {
  vertical-align: baseline;
}

textarea {
  overflow: auto;
  resize: vertical;
}

[type="checkbox"],
[type="radio"] {
  box-sizing: border-box;
  padding: 0;
}

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

[type="search"] {
  -webkit-appearance: textfield;
  outline-offset: -2px;
}

[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit;
}

details {
  display: block;
}

summary {
  display: list-item;
  cursor: pointer;
}

template {
  display: none;
}

[hidden] {
  display: none;
}

// 列表样式
ul,
ol {
  margin-top: 0;
  margin-bottom: $spacing-4;
  padding-left: $spacing-8;
}

ul ul,
ol ul,
ul ol,
ol ol {
  margin-bottom: 0;
}

dt {
  font-weight: $font-weight-semibold;
}

dd {
  margin-bottom: $spacing-2;
  margin-left: 0;
}

// 表格样式
table {
  border-collapse: collapse;
  width: 100%;
}

caption {
  padding-top: $spacing-3;
  padding-bottom: $spacing-3;
  color: var(--text-color-secondary);
  text-align: left;
  caption-side: bottom;
}

th {
  font-weight: $font-weight-semibold;
  text-align: inherit;
  vertical-align: bottom;
  border-bottom: 2px solid var(--border-color);
}

td {
  vertical-align: top;
  border-top: 1px solid var(--border-color);
}

th,
td {
  padding: $spacing-3;
}

// 表单样式重置
label {
  display: inline-block;
  margin-bottom: $spacing-2;
  font-weight: $font-weight-medium;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  padding: $spacing-2 $spacing-3;
  font-size: $font-size-base;
  line-height: $line-height-normal;
  color: var(--text-color-primary);
  background-color: var(--bg-color);
  background-clip: padding-box;
  border: 1px solid var(--border-color);
  border-radius: $border-radius-md;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  
  &:focus {
    color: var(--text-color-primary);
    background-color: var(--bg-color);
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }
  
  &::placeholder {
    color: var(--text-color-placeholder);
    opacity: 1;
  }
  
  &:disabled {
    background-color: var(--bg-color-secondary);
    opacity: 1;
  }
}

select {
  &:focus::-ms-value {
    color: var(--text-color-primary);
    background-color: var(--bg-color);
  }
}

// 滚动条样式
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color-secondary);
  border-radius: $border-radius-full;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: $border-radius-full;
  
  &:hover {
    background: var(--text-color-secondary);
  }
}

// 选择样式
::selection {
  background-color: var(--primary-color);
  color: white;
}

::-moz-selection {
  background-color: var(--primary-color);
  color: white;
} 